<?php

Raise::load('core.RaiseObject');

/**
 * TestCoreRaiseObject class
 * Testing unit of 'phpraise/core/RaiseObject.php'
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseObject extends RaiseTest {

    public static function testClass() {
        self::assertClassExists('RaiseObject');
        self::assertClassIsAbstract('RaiseObject');
        self::assertClassMethod('RaiseObject', array(
            'dispose',
            'equals',
            'hashCode',
            'raiseClone'
        ));
    }

    public static function testEquals() {
        $obj1 = new MockGenericObject();
        $obj2 = new MockGenericObject();
        $obj3 = $obj1;

        self::assertTrue($obj1->equals($obj1));
        self::assertTrue($obj1->equals($obj3));
        self::assertFalse($obj1->equals($obj2));
        self::assertFalse($obj2->equals($obj1));
    }

    public static function testHashCode() {
        $obj1 = new MockGenericObject();
        $obj2 = new MockGenericObject();
        $obj3 = $obj1;

        self::assertStrictEqual($obj1->hashCode(), $obj3->hashCode());
        self::assertType($obj1->hashCode(), 'string');
        self::assertType($obj2->hashCode(), 'string');
    }

}
